<?php

  $point=new class{
    public $x=40;
    public $y=20.3;
    public $z=50;
 };
class BB{
 public $name="LILI";
 public $age=25;
 public $color="red";
 public $arr=[11,22,33];
 public $point;
 public function __construct($point)
 {
    $this->point=$point;
 }
 public function __clone()
 {
   //实现深拷贝,每个对象都应该需要
   //// 强制复制一份this->object， 否则仍然指向同一个对象
    $this->point=clone $this->point; 
 }
};
$obj=new BB($point);
$o2=clone $obj;
 

var_dump($obj==$o2);
var_dump($obj===$o2);

$o2->name="JACK";
var_dump($obj==$o 2);

 

 
